#include<bits/stdc++.h>
using namespace std;
#define N 110
int n,m,a[N],b[N],ans;

bool ck2()
{
	for(int i=1;i<=n;++i)if(b[i]!=i)return 0;
	return 1;
}

void ck()
{
	for(int i=1;i<=n;++i)b[i]=i;
	for(int i=1;i<=m;++i)
	{
		for(int j=1;j<a[i];++j)swap(b[j],b[j+1]);
		//if(i==m)break;
		//if(ck2())return;
	}
	if(!ck2())return;
	++ans;
	//for(int i=1;i<=m;++i)if(a[i]!=1)cout<<a[i]<<' ';cout<<endl;
	//for(int i=1;i<=m;++i)cout<<a[i]<<' ';cout<<endl;
}

void dfs(int dp)
{
	if(dp>m)
	{
		ck();
		return;
	}
	for(int i=1;i<=n;++i)
	{
		a[dp]=i;
		dfs(dp+1);
	}
}

int main()
{
	freopen("drama.in","r",stdin);
	freopen("drama.out","w",stdout);
	scanf("%d%d",&n,&m);
	dfs(1);
	printf("%d",ans);
	return 0;
}
